package com.how2java.tmall.service;

import org.springframework.stereotype.Service;

/**
 * @Author: Andy
 * @Date: 2021年12月05日
 * @Description:
 */
@Service
public class OrderItemService {
//    @Autowired
//    OrderItemDAO orderItemDAO;
//    @Autowired ProductImageService productImageService;
//
//    public void fill(List<Order> orders) {
//        for (Order order : orders)
//            fill(order);
//    }
//
//    public void fill(Order order) {
//        List<OrderItem> orderItems = listByOrder(order);
//        float total = 0;
//        int totalNumber = 0;
//        for (OrderItem oi :orderItems) {
//            total+=oi.getNumber()*oi.getProduct().getPromotePrice();
//            totalNumber+=oi.getNumber();
//            productImageService.setFirstProdutImage(oi.getProduct());
//        }
//        order.setTotal(total);
//        order.setOrderItems(orderItems);
//        order.setTotalNumber(totalNumber);
//    }
//
//    public List<OrderItem> listByOrder(Order order) {
//        return orderItemDAO.findByOrderOrderByIdDesc(order);
//    }
}
